// eslint.config.mjs
import antfu from '@antfu/eslint-config'

export default antfu({
  rules: {
    'regexp/prefer-d': 'warn',
    'regexp/prefer-character-class': 'off',
    'regexp/use-ignore-case': 'warn',
    'regexp/no-unused-capturing-group': 'off',
    'regexp/no-super-linear-backtracking': 'off',
    'regexp/optimal-quantifier-concatenation': 'off',
    'regexp/no-misleading-capturing-group': 'off',
    'regexp/no-useless-range': 'off',
    'regexp/no-useless-non-capturing-group': 'off',
    'regexp/no-dupe-characters-character-class': 'off',
    'jsonc/sort-keys': 'off',
    'perfectionist/sort-imports': 'off',
    'perfectionist/sort-named-imports': 'off',
    '@typescript-eslint/no-explicit-any': 'warn',
    'prefer-const': 'off',
    '@typescript-eslint/no-unused-vars': 'warn',
    '@typescript-eslint/no-unused-expressions': 'off',
    'no-constant-binary-expression': 'warn',
    'no-constant-condition': 'warn',
    'ts/no-unused-vars': 'warn',
    'unused-imports/no-unused-vars': 'warn',
    'ts/no-use-before-define': 'off',
    'no-console': 'warn',
    'ts/consistent-type-definitions': 'off',
    'style/multiline-ternary': 'off',
    'eqeqeq': 'warn',
    'unicorn/prefer-includes': 'off',
    'no-unneeded-ternary': 'off',
    'regexp/prefer-w': 'off',
    'regexp/prefer-star-quantifier': 'off',
    'unicorn/escape-case': 'off',
    'antfu/top-level-function': 'off',
    'eslint-comments/no-unlimited-disable': 'warn',
    // 禁止使用 eval
    'ts/no-unsafe-function-type': 'error',
    // 禁止使用 process.env.NODE_ENV
    'n/prefer-global/process': 'off',
    // 限制代码中允许存在的连续空行数量
    'no-multiple-empty-lines': ['error', { max: 1 }],
    // 强制当导入的内容较多时，需要换行
    'object-curly-newline': ['error', {
      multiline: true,
      minProperties: 3,
    }],
    // 强制控制单行注释的位置
    'style/line-comment-position': ['warn', { position: 'above' }],
    // 强制注释符号与注释内容之间的空格
    'spaced-comment': 'error',
    'brace-style': ['error', '1tbs'],
    'test/consistent-test-it': 'off',
  },
  ignores: ['src/utils/utils.ts', 'docs'],
})
